import Vue from 'vue'
import VueRouter from 'vue-router'
import home from '../views/home.vue'

Vue.use(VueRouter)

const routes = [
  //重定向
  {
    path: '/',
    redirect: "/home/recommend"

  },
  //首页
  {
    path: '/home',
    name: 'home',
    component: home,
    children: [
      //首页-关注    
      { path: "/", redirect: "recommend" },
      {
        path: 'follow',
        name: 'follow',
        component: () => import('../views/Home/follow.vue')
      },
      //首页-推荐
      {
        path: 'recommend',
        name: 'recommend',
        component: () => import('.././views/Home/recommend.vue')
      },
      //首页-笔记
      {
        path: 'note',
        name: 'note',
        component: () => import('.././views/Home/note.vue')
      },
      //首页-视频
      {
        path: 'video',
        name: 'video',
        component: () => import('.././views/Home/video.vue')
      },
    ]
  },
  //首页-发菜谱  add
  {
    path: '/add',
    name: 'add',
    component: () => import('../components/home/add.vue')
  },
  //首页-搜索  search
  {
    path: '/search',
    name: 'search',
    component: () => import('../components/home/search.vue')
  },
  //首页-分类  category
  {
    path: '/category',
    name: 'category',
    component: () => import('../components/home/category.vue')
  },
  //首页-消息  news
  {
    path: '/news',
    name: 'news',
    component: () => import('../components/home/news.vue')
  },
  //首页-详情  details
  {
    path: '/details/:id',
    props:true,
    name: 'details',
    component: () => import('../components/home/details.vue')
  },

  //课堂
  {
    path: '/classroom',
    name: 'classroom',
    component: () => import('../views/classroom.vue')
  },
  //商城
  {
    path: '/supermarket',
    name: 'supermarket',
    component: () => import('../views/supermarket.vue')
  },
  //收藏
  {
    path: '/collection',
    name: 'collection',
    component: () => import('../views/collection.vue')
  },
  //我的
  {
    path: '/info',
    name: 'info',
    component: () => import('../views/info.vue')
  },
  //我的-登录
  {
    path: '/login',
    name: 'login',
    component: () => import('../components/Info/login.vue')
  },
  //我的-设置
  {
    path: '/setup',
    name: 'setup',
    component: () => import('../components/Info/setup.vue')
  },
]

const router = new VueRouter({
  routes
})

export default router
